Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for binary paths on macOS #127

Merged
merged 17 commits into from
Dec 5, 2024

Conversation

eugenesvk
Copy link
Contributor

@eugenesvk eugenesvk commented Dec 4, 2024

Adds a utf8 conversion step to allow creating valid Mac URLs for its file manager APIs as well as Finder

  • via a fast simd method if everything is fine
  • on fail replaces bytes in invalid utf8 sequences with %-encoded utf8 strings that are valid paths

fixes: #124

Test: the actual delete tests are DISABLED since they fails in CI and locally by default since modern APFS doesn't allow binary paths, but I've manually tested on a HFS usb drive that supports it.

Is there an easy way to create some virtual FS during testing so that the test works both locally and in CIs and doesn't require manual intervention?

Also for some reason got the same non-Mac unrelated clippy errors

@Byron
Copy link
Owner

Byron commented Dec 4, 2024

Is there an easy way to create some virtual FS during testing so that the test works both locally and in CIs and doesn't require manual intervention?

hdiutil can be used (example), and maybe there is a way to set the filesystem as well.

It's a bit messy as these filesystems of course affect the whole system, breaking isolation, but in practice it was no issue if the temporary filesystem is used to the fullest extent.

Also for some reason got the same non-Mac unrelated clippy errors

They probably happen as clippy got better over time, and this code wasn't touched in a while. Fixing them shouldn't be a problem though.

@eugenesvk
Copy link
Contributor Author

    // Don't run on CI as it's too slow there, resource busy, it fails more often than it succeeds by now.

:) so I guess not

@Byron
Copy link
Owner

Byron commented Dec 4, 2024

Even if it has to be disabled on CI in the end, it's useful to have test coverage on MacOS when running it locally, without assuming particular drives to be plugged in.

* avoid unused import (it's only used on Linux)
* make tests work locally (and possibly on CI) by creating temporary filesystems.
@Byron Byron force-pushed the fr-mac-byte-panic branch from 58ac14d to d23a591 Compare December 5, 2024 07:05
@Byron Byron merged commit 6f0b737 into Byron:master Dec 5, 2024
4 checks passed
@eugenesvk eugenesvk deleted the fr-mac-byte-panic branch December 5, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when deleting file with a non-UTF-8 name on a Mac
2 participants